<template>
	<div class="moduleShopList" v-if="!list.loading">
		<div class="search_wrap">
			<SeachNav @search="onSearch" @openPopup="openPopup"></SeachNav>
			<slot name="selectFilter"></slot>
			<div>
				<div class="filter_info_wrap"
					 v-if="showFilterInfo()">
					<div class="filter_info_wrap_left ellipsis_line_com">
						<span>筛选：</span>
						<span class="filter_info_name" v-for="item in manageData.isFilterList"
							  v-if="!$util.isEmpty(item)"
							  :key="item.id">
                    <template v-if="Array.isArray(item) && !$util.isEmpty(item)">
                        <span class="filter_info_name" v-for="items in item" :key="items.id">{{ items.name }}</span>
                    </template>
                    <span v-else>{{ item.name }}</span>
                </span>
						<!-- <slot name="filterNameWrap" :data="manageData">
							<span class="filter_info_name" v-for="item in data.isFilterList" v-if="item.name" :key="item.id">{{ item.name }}</span>
						</slot>-->
					</div>
					<div>共{{ list.total }}件</div>
				</div>
			</div>
		</div>
		<div class="content_list_wrap"
			 :class="{'content_list_max' : $util.isEmpty(manageData.isFilterList.catData) &&
			 $util.isEmpty(manageData.isFilterList.typeData) && $util.isEmpty(manageData.isFilterList.sourceData) &&
			  $util.isEmpty(manageData.isFilterList.searchData) ,
			  'showSearchTot' : showFilterInfo(),
			  'selectFilterTop' :selectFilter
			}">
			<div class="item_list box_shadow_body" v-for="(item,index) in list.data" :key="index"
				 @click="jumpListFn(item)">
				<div class="wanshandu" v-if="!$util.isEmpty(item.complete)">信息完善度{{item.complete}}% <i class="iconfont" style="font-size:12px;margin-top: 1px;">&#xe707;</i></div>
				<div class="item_list_top">
					<radio color="#ffd11a" :checked="item.status" @click.stop="checkList(item)"></radio>
					<div class="img_blo">
						<img :src="item._imgUrl" alt="图片">
					</div>
					<div class="shop_wrap">
						<div class="shop_title ellipsis_two_line_com">
							<span v-if="item._isSelf || item._isSelf == 0" class="shop_title_tag"
								  :class="[ item._isSelf == 1? 'merchant_tag' : 'self_tag']">{{ item._isSelfText }}</span>
							<span>{{ item._title }}</span>
						</div>

						<!--shopWrapCenter-->
							<slot name="shopAA" :item="item"></slot>

						<!--shopWrapBottom-->
						<slot name="shopA" :item="item"></slot>
						<!--微信slot缓存-->
						<slot name="shopAwx0" :item="item"></slot>
						<slot name="shopAwx1" :item="item"></slot>
						<slot name="shopAwx2" :item="item"></slot>
						<slot name="shopAwx3" :item="item"></slot>
						<slot name="shopAwx4" :item="item"></slot>
						<slot name="shopAwx5" :item="item"></slot>
						<slot name="shopAwx6" :item="item"></slot>
						<slot name="shopAwx7" :item="item"></slot>
						<slot name="shopAwx8" :item="item"></slot>
						<slot name="shopAwx9" :item="item"></slot>
						<slot name="shopAwx10" :item="item"></slot>
					</div>
				</div>

				<!--btnWrap-->
				<slot name="shopB" :item="item"></slot>
				<!--微信slot缓存-->
				<slot name="shopBwx0" :item="item"></slot>
				<slot name="shopBwx1" :item="item"></slot>
				<slot name="shopBwx2" :item="item"></slot>
				<slot name="shopBwx3" :item="item"></slot>
				<slot name="shopBwx4" :item="item"></slot>
				<slot name="shopBwx5" :item="item"></slot>
				<slot name="shopBwx6" :item="item"></slot>
				<slot name="shopBwx7" :item="item"></slot>
				<slot name="shopBwx8" :item="item"></slot>
				<slot name="shopBwx9" :item="item"></slot>
				<slot name="shopBwx10" :item="item"></slot>
			</div>
		</div>
		<!-- 底部按钮 -->
		<div class="content_bottom_wrap">
			<div class="content_bottom_wrap_left">
				<radio color="#ffd11a" @click="changeAllCheck" :checked="manageData.checkList!=0"></radio>
				<span>全选</span>
				<span class="sub_text_color">（已选{{ manageData.checkList.length }}件）</span>
			</div>
			<slot name="bottomBtnWrap"></slot>
		</div>
	</div>
</template>

<script>

import SeachNav from '@/pages/components/SeachNav.vue'

export default {
	name: 'module-shop-list',
	components: {
		SeachNav
	},
	props: {
		manageData: {
			type: Object,
			default: () => {
			}
		},
		list: {
			type: Object,
			default: () => {
			}
		},
		selectFilter: {
			type: Boolean,
			default: () => false
		}
	},
	data() {
		return {}
	},
	mounted() {
	},
	methods: {
		// 搜索
		onSearch(val) {
			this.$emit('onSearch', val)
		},
		// 跳转商城
		jumpListFn(item) {
			this.$emit('jumpListFn', item)
		},
		// 列表选择
		checkList(item) {
			this.$emit('checkList', item)
		},
		openPopup(item) {
			this.$emit('openPopup', item)
		},

		// 切换全选
		changeAllCheck(evt) {
			this.$emit('changeAllCheck', evt.target.value)
		},
		showFilterInfo() {
		    // console.log(666, this.manageData.isFilterList)
			let filterObj = this.manageData.isFilterList
			let show = false
			for (let key in filterObj) {
				if (!this.$util.isEmpty(filterObj[key])) {
					show = true
					break
				}
			}
			return show
		}
	}
}
</script>

<style lang="scss" scoped>

	.moduleShopList {
		width: 100%;
		height: 100%;

		.search_wrap {
			position: fixed;
			left: 0;
			background-color: #fff;
			top: 92px;
			box-shadow: -2px 2px 5px #cccccc;
			width: 100%;
			z-index: 888;
		}

		// 列表
		.content_list_max {
			margin-top: 186px;
		}

		// 筛选显示块
		.filter_info_wrap {
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 70px; /*no*/
			padding: 0 30px;
			color: #ff6900;
			background-color: #fffbeb;
			position: fixed;
			width: calc(100vw - 60px);
			.filter_info_wrap_left {
				width: 70%;

				.filter_info_name {
					margin-right: 4px;
				}

				.filter_info_name::after {
					content: '+';
				}

				.filter_info_name:last-child:after {
					content: '';
				}
			}
		}

		// 公共底部
		.content_bottom_wrap {
			position: fixed;
			bottom: 0;
			width: calc(100% - 60px);
			height: 100px; /*no*/
			padding: 0 30px;
			display: flex;
			align-items: center;
			justify-content: space-between;
			background-color: #fff;
			box-shadow: -4px -4px 10px #cccccc;

			.sub_text_color {
				color: #666;
			}

			.content_bottom_wrap_left {
				display: flex;
				align-items: center;
			}

			.shop_btn_wrap {
				display: flex;
				align-items: center;
			}

			.iconfont_wrap {
				margin-right: 10px;
			}
		}

		// 公共勾选
		.iconfont_wrap {
			width: 48px;
			height: 48px;
			flex-shrink: 0;

			& > i {
				font-size: 46px;
				color: #fff;
				border: 1px solid $borderColorMain; /*no*/
				border-radius: 50%;
			}
		}

		.iconfont_wrap.active {
			& > i {
				color: #3a1b04;
				background-color: #ffd11a;
				border-color: #fff;
			}
		}
	}

	.contentBox {
		margin-top: 100px;
		padding-bottom: 150px;
	}

	.moduleShopList {
		/*公共列表*/
		.content_list_wrap {
			width: 100%;
			padding: 0 0 100px;
			// height: calc(100% - 89px); /*no*/
			height: calc(100% - 139px); /*no*/
			overflow-y: auto;
			// .van-pull-refresh, .van-pull-refresh__track, .van-list {
			//     height: 100%;
			// }
			.item_list {
				margin: 20px 30px;
				padding: 30px 20px 20px;
				background-color: #fff;
				border-radius: 16px;
				.wanshandu{
					display: flex;
					justify-content: flex-end;
					color: #ff6900;
					margin-bottom: 20px;
				}
				.item_list_top {
					display: flex;
					align-items: center;

					.img_blo {
						width: 180px;
						height: 180px;
						margin: 0 20px;
						flex-shrink: 0;

						img {
							object-fit: cover;
							border-radius: 10px;
							width: 180px;
							height: 180px;
						}
					}

					.shop_wrap {
						color: $fontColor2;
						height: 180px;
						display: flex;
						flex-direction: column;
						justify-content: space-between;
						flex: 1;

						.shop_title {
							font-size: 30px;
							font-weight: 600;
							color: #333;
							min-height: 76px;

							.shop_title_tag {
								font-size: 24px;
								font-weight: 400;
								padding: 0 6px;
							}

							.shop_title_tag.self_tag {
								color: #ff6900;
								background-color: #fff5ef;
							}

							.shop_title_tag.merchant_tag {
								color: #2965fe;
								background-color: #f3f3fe;
								padding: 0;
							}
						}

						& > div:nth-child(2) {
							margin-bottom: 12px;
						}
					}
				}

			}

			&.selectFilterTop{
				margin-top: 240px;
			}
		}

		.shop_btn_wrap {
			display: flex;
			justify-content: end;
			align-items: center;
		}
		.showSearchTot{
			margin-top: 260px;
			&.selectFilterTop{
				margin-top: 306px;
			}
		}
	}
</style>

